<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>快速注册</title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/base.css" />
		<script src="js/flexible.js"></script>
		<link rel="stylesheet" href="css/kuaisuzhuce.css" />
		<script src="js/jquery-3.1.1.js"></script>
		<script src="js/config.js"></script>

	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" style="color: #333;"></a>
			<h1 class="mui-title">快速注册</h1>
		</header>
		<form class="mui-input-group" style="margin-top: 44px;">
			<div class="mui-input-row">
				<label>手机号</label>
				<input type="text" placeholder="请输入手机号" id="phone">
			</div>
			<div class="mui-input-row">
				<label>验证码</label>
				<input type="text" placeholder="请输入短信验证码" id="phoneCode">

			</div>
			<div class="mui-input-row">
				<label>密码</label>
				<input type="password" placeholder="请输入6-12位密码" id="password">
			</div>
			<div class="mui-input-row">
				<label>确认密码</label>
				<input type="password" placeholder="请再次输入密码" id="rpass">

			</div>

		</form>
		<div class="mui-content" style="background: none;padding-top: 0;margin-top: 1.5rem;">
			<div class="mui-content-padded">
				<button type="button" class="mui-btn mui-btn-primary mui-btn-block" id="btn" style="font-size: 0.4rem;">完成注册</button>
			</div>
		</div>
		<script type="text/javascript">
			//获取手机号码和验证码
			var loc = location.href;
			var locArr = loc.split('='); //=号截取数据
			$('#phone').val(locArr[1]);
			var loginI=locArr[3];
			$("#phone").blur(function() {
				var phone = $('#phone').val();
				// alert(phone);
				var reg = /^1[3|4|5|8|7|9|6][0-9]\d{8}$/;
				if(phone == "" || !reg.test(phone)) {
					mui.toast("请正确填写手机号码");
					return;
				}
			})
			$("#btn").on('tap', function() {
				var userPhone = $("#phone").val()
				var phoneCode = $("#phoneCode").val()
				var password = $("#password").val()
				var rpass = $("#rpass").val()
				mui.ajax(config.host + '/home/Login/register', {
					data: {
						phone: userPhone,
						pCode: phoneCode,
						password: password,
						rpass: rpass,
						reCode:loginI
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型	              
					success: function(data) {
						if(data.code == 200) {
							mui.toast(data.msg)
							location.href = 'xiazai.html'
						} else {
							mui.toast(data.msg)
						}
					}
				});
			})
		</script>
	</body>

</html>